import java.awt.BorderLayout;

import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import gui.MainPanel;
import gui.Splash;
import utils.GlobalConstants;
import utils.Settings;
import java.awt.Window.Type;



public class MGTranscoder extends JFrame implements GlobalConstants {

	final int WIDTH_WINDOW = 528;
	final int HEIGHT_WINDOW = 400;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		INI_SETTINGS.validTest();
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MGTranscoder frame = new MGTranscoder();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MGTranscoder() {
		setTitle("MGTranscoder");
		setResizable(false);
		
		//Set the look and feel to users OS LaF.
	    try {
	        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	    } catch (ClassNotFoundException e) {
	        e.printStackTrace();
	    } catch (InstantiationException e) {
	        e.printStackTrace();
	    } catch (IllegalAccessException e) {
	        e.printStackTrace();
	    } catch (UnsupportedLookAndFeelException e) {
	        e.printStackTrace();
	    }
		
		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		int x = (screen.width / 2) - (WIDTH_WINDOW / 2); // Center horizontally.
		int y = (screen.height / 2) - (HEIGHT_WINDOW / 2); // Center vertically.
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		setBounds(x, y, WIDTH_WINDOW, HEIGHT_WINDOW);
		
		setContentPane(new MainPanel());
		
		new Thread()
		{
		    public void run() {
		    	Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		    	try {
					new Splash((screen.width / 2)-(260 / 2), (screen.height / 2) - (144 / 2));
				} catch (InterruptedException e){}
		    	
		    }
		}.start();
	}

}
